// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-11-16

#include "stdafx.h"
#include "db_convert.h"

namespace JoyServer
{

void DbConvert(DBTIMESTAMP& dbTime, const SYSTEMTIME& sysTime)
{
    dbTime.year     = sysTime.wYear;
    dbTime.month    = sysTime.wMonth;
    dbTime.day      = sysTime.wDay;
    dbTime.hour     = sysTime.wHour;
    dbTime.minute   = sysTime.wMinute;
    dbTime.second   = sysTime.wSecond;
    dbTime.fraction = 0;
}

void DbConvert(UINT& nValue, const DB_NUMERIC& numValue)
{
    nValue = *(UINT*)(numValue.val);
    if(!numValue.sign)
    {
        nValue = (UINT)(-(int)nValue);
    }
}

void DbConvert(INT& nValue, const DB_NUMERIC& numValue)
{
    nValue = *(INT*)(numValue.val);
    if(!numValue.sign)
    {
        nValue = (INT)(-(int)nValue);
    }
}

} // namespace JoyServer